import {http}from'@/utils'
import type {ResType} from './shared'


//2.定义具体的接口类型
 export type ChannelItem={
  id:number,
  name:string
}
type ChannelRes={
  channels:ChannelItem[]
}
//封装函数 请求频道列表
export function fetchChannelAPI(){
 return http.request<ResType<ChannelRes>>({
    url:'/channels',
  })
}
//请求文章列表的
 type  ListItem={
  art_id:string,
  title:string,
  aut_id:string,
  common_count:number,
  pubdate:string,
  aut_name:string,
  is_top:number,
  cover:{
    type:number,
    images:string[]
  }

}
export type ListRes={
  results:ListItem[],
pre_timestamp:string
}
export type ResParams={
  channel_id:string
  timestamp:string
}//含参的封装
export function fetchListlAPI(params:ResParams,){
  return http.request<ResType<ListRes>>({
    url:'./articles',
    params
  })
}
//封装好接口